import java.util.Random;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:DELL
 * Date:2024-10-13
 * Time:18:13
 */
public class Test1 {
    public static void main(String[] args) {
        int i = 20;
        int j = 40;
        int k = (i > j ? i : j);
        while (true) {
            if (i % k == 0) {
                if (j % k == 0) {
                    break;
                }
            }
            k--;
        }
        System.out.println(k);

    }
    public static void main5(String[] args) {
        int count=3;
        Scanner scan=new Scanner(System.in);
        while(count!=0){
            System.out.println("请输入密码");
            String password= scan.nextLine();
            if(password.equals("123")){
                System.out.println("登陆成功");
                break;
            }else{
                count--;
                System.out.println("你还有"+count+"次机会！");
            }
        }
    }
    public static void main4(String[] args) {
        Scanner scan =new Scanner(System.in);
        int num= scan.nextInt();
        while (num!=0){
            System.out.println(num%10);
            num/=10;
        }
    }
    public static void main3(String[] args) {
        Scanner scan=new Scanner(System.in);
        Random random=new Random();
        int randNum= random.nextInt(101);//[0,101)
        //50~100的随机数 random.nextInt(50）--[0,50)+50;
        while(true){
            System.out.println("请输入你要猜的数字");
            int num= scan.nextInt();
            if(num<randNum){
                System.out.println("猜小了");
            } else if (num==randNum) {
                System.out.println("猜对了");
                break;
            }else{
                System.out.println("猜大了");
            }
        }

    }

    public static void main2(String[] args) {
        double sum=0;
        int flag=1;
        int i=0;
        for(i=1;i<=100;i++){
            sum+=(1.0/i)*flag;
            flag=-flag;
        }
        System.out.println(sum);
    }
    public static void main1(String[] args) {
        int i=0;
        int count=0;
        for(i=1;i<=100;i++){
           if(i%9==0){
               count++;
           }
           if(i/9==0){
               count++;
           }
        }
        System.out.println(count);
    }
}
